package fm.kgis.fm.service
{
	import com.kgis.fm.common.proxy.DefaultServiceProxy;
	import com.kgis.fm.flex.model.business.Entity;
	import mx.collections.ArrayCollection;
	public class CommonManagementService extends DefaultServiceProxy
	{
		private static const SERVICE_NAME:String = "commonManagementService";
		
		
		
		public function CommonManagementService() {
			super(SERVICE_NAME);
			
			
		}
		
		
		
		/**
		 */
		public function findById(
			entityTypeId:Number,
			entityId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findById", [entityTypeId, entityId], callback, context);
		}
		
		/**
		 */
		public function findByIds(
			entityTypeId:Number,
			ids:Array/* long */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findByIds", [entityTypeId, ids], callback, context);
		}
		
		/**
		 */
		public function removeSpatialOnly(
			entity:Entity,
			callback:Function = null,
			context:Object = null
		):void {
			callService("removeSpatialOnly", [entity], callback, context);
		}
		
		/**
		 */
		public function findByIdWithGeomotry(
			entityTypeId:Number,
			entityId:Number,
			detailId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findByIdWithGeomotry", [entityTypeId, entityId, detailId], callback, context);
		}
		
		/**
		 */
		public function newEntityByMetaEntityTypeId(
			metaEntityTypeId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("newEntityByMetaEntityTypeId", [metaEntityTypeId], callback, context);
		}
		
		/**
		 */
		public function newEntityByEntityTypeId(
			entityTypeId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("newEntityByEntityTypeId", [entityTypeId], callback, context);
		}
		
		/**
		 */
		public function newEntityByMetaEntityTypeCode(
			metaEntityTypeCode:String,
			callback:Function = null,
			context:Object = null
		):void {
			callService("newEntityByMetaEntityTypeCode", [metaEntityTypeCode], callback, context);
		}
		
		/**
		 */
		public function newEntityByEntityTypeCode(
			entityTypeCode:String,
			metaEntityTypeCode:String,
			callback:Function = null,
			context:Object = null
		):void {
			callService("newEntityByEntityTypeCode", [entityTypeCode, metaEntityTypeCode], callback, context);
		}
		
		/**
		 */
		public function findByIdAndMetaEntityTypeCode(
			metaEntityTypeCode:String,
			entityId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findByIdAndMetaEntityTypeCode", [metaEntityTypeCode, entityId], callback, context);
		}
		
		/**
		 */
		public function findByIdAndMetaEntityTypeId(
			metaEntityTypeId:Number,
			entityId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findByIdAndMetaEntityTypeId", [metaEntityTypeId, entityId], callback, context);
		}
		
		/**
		 */
		public function createWithRelations(
			model:Entity,
			entitys:mx.collections.ArrayCollection/* com.pktech.nip.platform.model.business.Entity */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("createWithRelations", [model, entitys], callback, context);
		}
		
		/**
		 */
		public function updateWithRelations(
			model:Entity,
			entitys:mx.collections.ArrayCollection/* com.pktech.nip.platform.model.business.Entity */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("updateWithRelations", [model, entitys], callback, context);
		}
		
		/**
		 */
		public function saveWithRelations(
			model:Entity,
			entitys:mx.collections.ArrayCollection/* com.pktech.nip.platform.model.business.Entity */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("saveWithRelations", [model, entitys], callback, context);
		}
		
		/**
		 */
		public function updateList(
			entitys:mx.collections.ArrayCollection/* com.pktech.nip.platform.model.business.Entity */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("updateList", [entitys], callback, context);
		}
		
		/**
		 */
		public function removeList(
			models:mx.collections.ArrayCollection/* com.pktech.nip.platform.model.business.Entity */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("removeList", [models], callback, context);
		}
		
		/**
		 */
		public function findByIdsAndMetaEntityTypeId(
			metaEntityTypeId:Number,
			entityIds:Array/* long */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findByIdsAndMetaEntityTypeId", [metaEntityTypeId, entityIds], callback, context);
		}
		
		
		
		/**
		 */
		public function findEntityByIdAndMetaOrAttributeTypeId(
			metaAttributeTypeId:Number,
			attributeTypeId:Number,
			entityId:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findEntityByIdAndMetaOrAttributeTypeId", [metaAttributeTypeId, attributeTypeId, entityId], callback, context);
		}
		
		/**
		 */
		public function findEntityByIdsAndMetaOrAttributeTypeId(
			metaAttributeTypeId:Number,
			attributeTypeId:Number,
			entityIds:mx.collections.ArrayCollection/* java.lang.Number */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findEntityByIdsAndMetaOrAttributeTypeId", [metaAttributeTypeId, attributeTypeId, entityIds], callback, context);
		}
		
		/**
		 */
		public function saveEntityParamWithRelations(
			model:Entity,
			entityParams:mx.collections.ArrayCollection/* com.pktech.irm.business.management.vo.EntityParam */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("saveEntityParamWithRelations", [model, entityParams], callback, context);
		}
		
		/**
		 * 
		 对于ENUMERABLE_REFERENCE 显示由于数据量太大，无法通过下拉的方式来选择，特通过查询来展现 对于查看或修改时本身的属性展现
		 用此方法 根据metaAttributeTypeId or attributeTypeId查询对应的EnumerableModel
		 
		 
		 * 
		 * @param metaAttributeTypeId 
		 * @param attributeTypeId 
		 * @param id 
		 * @param userContext 
		 * @return  
		 */
		public function findEnumerableModelByIdAndMetaOrAttributeTypeId(
			metaAttributeTypeId:Number,
			attributeTypeId:Number,
			id:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findEnumerableModelByIdAndMetaOrAttributeTypeId", [metaAttributeTypeId, attributeTypeId, id], callback, context);
		}
		
		/**
		 * 
		 需要特殊考虑多不多查询时联想的字段 对于关系的输入框支持联想功能，支持配置默认联想的字段 从性能考虑，只支持后模糊查询 默认出前20个
		 
		 
		 * 
		 * @param metaAttributeTypeId 在metaentitytype下查找
		 
		 * @param attributeTypeId 优先此字段 在具体类型下找
		 
		 * @param inputValue 前台输入字段
		 
		 * @param parameters 前置的查询条件，如点端口时，所属设备要带过来
		 
		 * @param userContext 
		 * @return  
		 */
		public function findEntityByAssociateNameMetaOrAttributeTypeId(
			metaAttributeTypeId:Number,
			attributeTypeId:Number,
			inputValue:String,
			parameters:Object/* java.lang.String */,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findEntityByAssociateNameMetaOrAttributeTypeId", [metaAttributeTypeId, attributeTypeId, inputValue, parameters], callback, context);
		}
		
		
		
		/**
		 * 
		 It is used for querying multi-entitytypes entityList
		 
		 
		
		
		/**
		 * 
		 对于模板上等非entity上的字段，需要特殊处理
		 
		 
		 * 
		 * @param metaEntityTypeCode 
		 * @param entityTypeCode 
		 * @param propertyCode 
		 * @param id 
		 * @param userContext 
		 * @return  
		 */
		public function findEnumerableModelByIdAndMetaOrEntityTypeCode(
			metaEntityTypeCode:String,
			entityTypeCode:String,
			propertyCode:String,
			id:Number,
			callback:Function = null,
			context:Object = null
		):void {
			callService("findEnumerableModelByIdAndMetaOrEntityTypeCode", [metaEntityTypeCode, entityTypeCode, propertyCode, id], callback, context);
		}
		
		
		
		/**
		 */
		public function remove(
			entity:Entity,
			callback:Function = null,
			context:Object = null
		):void {
			callService("remove", [entity], callback, context);
		}
		
		/**
		 */
		public function save(
			entity:Entity,
			callback:Function = null,
			context:Object = null
		):void {
			callService("save", [entity], callback, context);
		}
		
		/**
		 */
		public function create(
			entity:Entity,
			callback:Function = null,
			context:Object = null
		):void {
			callService("create", [entity], callback, context);
		}
		
		/**
		 */
		public function update(
			entity:Entity,
			callback:Function = null,
			context:Object = null
		):void {
			callService("update", [entity], callback, context);
		}
	}
}